package com.app.util.limiter;

/**
 * 频率限制配置对象
 * 
 * @author yao
 */
public class LimitMaxs {

	private Object lock = new Object();
	private int[] maxes;
	private LimitNames limitNames;

	public LimitMaxs(LimitNames limitNames) {
		this.limitNames = limitNames;
		this.maxes = new int[limitNames.size()]; 
	}

	public void setMax(String name, int max) {
		synchronized (lock) {
			maxes[limitNames.getNameItem(name).getIndex()] = max;
		}
	}

	public int getMax(String name) {
		return maxes[limitNames.getNameItem(name).getIndex()];
	}

}
